public class Eat_Sleep_Code {
    public static int fac(int num) {
        if (num <= 2) {
            return num;
        }else {
            
        }
    }
    public static void main(String[] args) {

    }
    public static int sum(int x, int y){
        return x + y;
    }
    public static double sum(double x, double y){
        return x + y;
    }
    public static void main15(String[] args) {
        System.out.println(sum(1, 2));
        System.out.println(sum(1.5, 2.5));
    }
    public static int play(int x, int y) {
        return x > y ? x : y;
    }

    public static double play(double x, double y) {
        return x > y ? x : y;
    }

    public static double play(double x, double y, double z) {
        double MaxDouble = x > y ? x : y;
        return MaxDouble > z ? MaxDouble : z;
    }

    public static void main14(String[] args) {
        int ret1 = play(10, 20);
        double ret2 = play(12.2,12.3);
        double ret3 = play(1.1, 1.2, 1.3);
        System.out.println(ret1);
        System.out.println(ret2);
        System.out.println(ret3);
    }
    public static int add(int n , int k) {
        return n + k;
    }
    public static double add(double n , double k) {
        return n + k;
    }
    public static void main13(String[] args) {
        int x = 10;
        int y = 20;
        int ret1 = add(x, y);
        double a = 12.5;
        double b = 13.4;
        double ret2 = add(a, b);
        System.out.println(ret1);
        System.out.println(ret2);
    }
    public static int add2(int x, int y) {
        return x + y;
    }

    public static void main12(String[] args) {
        int a = 10;
        int b = 20;
        System.out.println(add2(a, b));
    }
    public static void add13(int x, int y) {
        int sum = x + y;
        System.out.println(sum);
    }

    public static void main11(String[] args) {
        int a = 10;
        int b = 20;
        add13(a, b);
    }
    public static void main10(String[] args) {
        int[] arr = {10, 20};
        swap(arr);
        System.out.println("arr[0] = " + arr[0] + " arr[1] = " + arr[1]);
    }
    public static void swap(int[] arr) {
        int tmp = arr[0];
        arr[0] = arr[1];
        arr[1] = tmp;
    }
    public static void eat(int n, int k) {
        int tmp = n;
        n = k;
        k = tmp;
        System.out.print(n);
        System.out.println(k);
    }

    public static void main9(String[] args) {
        eat(10, 20);

    }
    public static void swap(int x, int y) {
        int tmp = x;
        x = y;
        y = tmp;
        System.out.println("交换后：" + "x = " + x + "y = " + y);
    }

    public static void main8(String[] args) {
        int a = 4;
        int b = 6;
        swap(4, 6);
        System.out.println("交换前：" + "a = " + a + "b = " + b);
    }
    public static int fac(int num) {
        int ret = 1;
        for (int i = 1; i <= num ; i++) {
            ret *= i;
        }
        return ret;
    }

    public static void main7(String[] args) {
        int sum = 0;
        for (int i = 1; i <= 5; i++) {
            sum += fac(i);
        }
        System.out.println(sum);
    }
    public  static int mul(int x, int y) {
        return x * y;
    }

    public static void main6(String[] args) {
        int ret1 = mul(3, 7);
        int ret2 = mul(10, 10);
        System.out.println("ret1:" + ret1);
        System.out.println("ret2:" + ret2);
    }
    public static int sub(int x, int y) {
       return x - y;
    }

    public static void main5(String[] args) {
        int ret = sub(10, 5);
        System.out.println(ret);
    }
    public static int isleapyear(int year) {
        if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
            return 1;
        }else {
            return -1;
        }
    }
    public static void main4(String[] args) {
        int ret = isleapyear(2022);
        if (1 == ret) {
            System.out.println("2022是闰年");
        }else {
            System.out.println("2022不是闰年");
        }
    }
    public static void array(int[] arr) {
        for (int i = 0; i < 10 ; i++) {
            arr[i] = i + 1;
            System.out.println(arr[i]);
        }
    }
    public static void main3(String[] args) {
        int[] arr = new int[10];
        array(arr);

    }
    public static void main2(String[] args) {
        int[] arr = new int[100];
        for (int i = 0; i < 100 ; i++) {
            arr[i] = i + 1;
            System.out.printf("%d ", arr[i]);
        }
    }
    public static int fib(int num) {
        int FibOne = 1;//前一项的前一项
        int FibTwo = 1;//前一项
        int FibThree =1; //第三项
        for (int i = 3; i <= num ; i++) {
            FibThree = FibOne + FibTwo;
            FibOne = FibTwo;
            FibTwo = FibThree;
        }
        return FibThree;
    }
    public static void main1(String[] args) {
        System.out.println(fib(1));
        System.out.println(fib(2));
        System.out.println(fib(3));
        System.out.println(fib(4));
        System.out.println(fib(5));
    }
}
